global.Memo = db.collection("Menstruation.Memo");
module.exports = {
	get: function(req, res) {
		co(function*() {
			var memoCount = (yield Memo.count()) || 1;
			var doc = yield Memo.find({}).skip(memoCount - 1).limit(1).toArray();
			res.send(doc[0] || {});
		}).catch(e => {
			console.log(e);
			res.send({});
		});
	},
	post: function(req, res) {
		var memoData = req.body;
		memoData.time = new Date().getTime();
		Memo.insertOne(memoData);
		res.send({});
	}
}